package Collection.List;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("666");
        list.add("7777");
        list.add("8888");

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("----------");
        for (String s : list) {
            System.out.println(s);
        }
        System.out.println("----------");
        list.forEach(s -> System.out.println(s));
        System.out.println("----------");
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
